"""
ndarray对象基本属性
"""

import numpy as np

ary = np.arange(1,9)

# 修改维度
# a,b = 1,2
# ary.shape = (2,4) #直接修改原数据维度
# ary.shape = (2,2,2)
# ary.shape = (1,1,1,1,1,8)
#
# print(ary)
# print(ary.shape)

# 修改元素类型
# ary.dtype = 'float64' # 只能修改解析方式，不能修改类型
# res = ary.astype('float64')
# print(res)
ary.shape = (2,2,2)
print(ary)
# 元素的个数
# print(ary.size)
# print(len(ary))
# 索引
print(ary[0])
print(ary[0][0])
print(ary[0][0][0])

print(ary[0,0,0]) # 数组[页，行，列]

for i in range(ary.shape[0]):
    for j in range(ary.shape[1]):
        for k in range(ary.shape[2]):
            print(ary[i,j,k])